import redis
from lib.utils.config_loader import load_config

cache_config = load_config('cache.ini')  # 加载应用配置文件
redis_host = cache_config.get('redis', 'host')
redis_port = int(cache_config.get('redis', 'port'))
redis_password = cache_config.get('redis', 'password', fallback='')
redis_db = int(cache_config.get('redis', 'db'))
# 假设Redis运行在本地主机上，并使用默认端口
redis_client = redis.Redis(host=redis_host, port=redis_port, password=redis_password, db=redis_db,
                           decode_responses=True)


def get_redis_client():
    return redis_client
